<template>
  <div class="wrapper" ref="goodswrapper">
    <div class="cotent">
      <slot></slot>
    </div>
  </div>
</template>

<script>
import BScroll from '@better-scroll/core';
import Pullup from '@better-scroll/pull-up';
BScroll.use(Pullup);
export default {
  components: {},
  props: ['datas'],
  data() {
    return {
      BS: null,
    };
  },
  computed: {},
  methods: {
    refresh(){
      this.$nextTick(()=>{
        this.BS.refresh();
      })
    },
    back_top(x,y,time=500){
      this.BS.scrollTo(x,y,time);
    }
  },
  created() {},
  mounted() {
    this.BS = new BScroll(this.$refs.goodswrapper, {
        observeDOM:true,
        click:true,
        probeType: 3,
        pullUpLoad: true,
      });
    this.BS.on("pullingUp", () => {
        setTimeout(() => {
          this.$emit("pullingUp");
          console.log('pulling');
          this.BS.finishPullUp();
        },100);
      });
    // this.BS.on("pullingDown", () => {
    //     // setTimeout(() => {
    //       console.log('pullingDown');
    //     // },100);
    //   });
    this.BS.on("scroll",(position)=>{
      this.$emit("scroll",position);
    })
  },
  
};
</script>
<style scoped>
.wrapper {
  overflow: hidden;
  position:absolute;
  top:44px;
  bottom:40px;
  left: 0;
  right: 0;
  height:auto;
  margin:0;
}
</style>